#==============================================================================
#
#  $Id: naming.py,v 1.2 1999/07/09 13:49:12 mike Exp $
#
"""
   Naming service classes.
"""
#
#  Copyright (C) 1999 Michael A. Muller
#
#  Permission is granted to use, modify and redistribute this code,
#  providing that the following conditions are met:
#
#  1) This copyright/licensing notice must remain intact.
#  2) If the code is modified and redistributed, the modifications must 
#  include documentation indicating that the code has been modified.
#  3) The author(s) of this code must be indemnified and held harmless
#  against any damage resulting from the use of this code.
#
#  This code comes with ABSOLUTELY NO WARRANTEE, not even the implied 
#  warrantee of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
#
#  $Log: naming.py,v $
#  Revision 1.2  1999/07/09 13:49:12  mike
#  Added has_key() method to interface.
#
#  Revision 1.1  1999/06/16 14:32:22  mike
#  First cut at name services.
#
#
#==============================================================================

from dopy import ImplementedBySubclassError
from UserDict import UserDict

class NamingContext:
   
   """
      The standard DOPY name service base class.  Derived classes should
      override #`__getitem__()`#, #`__setitem__()`#, #`__delitem__()`#
      #items()#, #values()# and #keys()#.
      
      This has the same name as the CORBA COS NamingContext class, but has a
      very different interface.
   """
   
   def __getitem__(self, key):
      raise ImplementedBySubclassError()
   
   def __setitem__(self, key, val):
      raise ImplementedBySubclassError()

   def __delitem__(self, key):
      raise ImplementedBySubclassError()

   def items(self):
      raise ImplementedBySubclassError()
   
   def values(self):
      raise ImplementedBySubclassError()
   
   def keys(self):
      raise ImplementedBySubclassError()

   def has_key(self):
      raise ImplementedBySubclassError()

class StandardNamingContext(UserDict, NamingContext):
   
   """
      Instances of this class provide a naming context that functions
      as a standard dictionary.
   """
   
   pass
   